package com.welse.modulebiz.controller;

import com.welse.modulebiz.domain.ApArticle;
import com.welse.modulebiz.domain.ArticleDto;
import com.welse.modulebiz.domain.Result;
import com.welse.modulebiz.service.ApArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/article")
public class ArticleController {

    @Autowired
    private ApArticleService apArticleService;

    @PostMapping("/load")
    public Result<List<ApArticle>> load(ArticleDto articleDto){
        return apArticleService.loadArticleList(articleDto, (short) 1);
    }

    @PostMapping("/loadMore")
    public Result<List<ApArticle>> loadMore(ArticleDto articleDto){
        return apArticleService.loadArticleList(articleDto, (short) 1);
    }

    @PostMapping("/loadNew")
    public Result<List<ApArticle>> loadNew(ArticleDto articleDto){
        return apArticleService.loadArticleList(articleDto, (short) 2);
    }
}
